const std = @import("std");
const c = @import("../component.zig");

pub fn movementSystem(
    es: *const c.EntityStorage, 
    ps: *c.PositionStorage,
    vs: *const c.VelocityStorage,
) anyerror!void {
    var it = es.iter(.{.Position, .Velocity});
    while (it.next()) |e| {
        var pos = ps.get(e);
        var vel = vs.get(e);

        const value = c.Position {
            .x = pos.x + vel.x,
            .y = pos.y + vel.y,
            .z = pos.z + vel.z,
        };

        ps.set(e, value);
    }
}
